package sg.nus.iss.vmcs.guilisteners;

import java.awt.TextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import sg.nus.iss.vmcs.controllers.AccessManager;

/**
 * Action Listener for the Password input in the Maintenance Panel<br><br>
 * Modifications:
 * <li>Philip - 28/12/2010 - Removed temporary variables in actionPerformed</li>
 * <br><br>
 * @author Pang Pingli
 * @author Philip Chew
 */
public class PasswordListener implements ActionListener {

	/** Access Manager */
	private AccessManager actrl;

	/**
	 * Creates an instance of the Password Listener
	 * @param ac Reference to AccessManager
	 */
	public PasswordListener(AccessManager  ac) {
		actrl = ac;
	}
	
	/**
	 * Implementation of ctionPerformed
	 */
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() instanceof TextField) {
			actrl.processPassword(((TextField)e.getSource()).getText());
		}
	}
}